<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>MD_MAX72xx LED Matrix Arduino Library: Create and Modify Fonts</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="MAX72xx Icon.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MD_MAX72xx LED Matrix Arduino Library
   &#160;<span id="projectnumber">2.8</span>
   </div>
   <div id="projectbrief">Library to control connected  MAX72XX devices as a pixel array</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('pageFontUtility.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Create and Modify Fonts </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2>Font Storage Format </h2>
<p>One default font is defined as part of the library in PROGMEM memory. Alternative fonts can be specified to the library. The font builder utilities provide a convenient way to modify existing or develop alternative fonts.</p>
<p>Fonts are stored as a series of contiguous bytes in the following format:</p><ul>
<li>byte 1 - the number of bytes that form this character (could be zero)</li>
<li>byte 2..n - each byte is a column of the character to be formed, starting with the leftmost column of the character. The least significant bit of the byte is the bottom pixel position of the character matrix (row 7).</li>
</ul>
<p>To find a character in the font table, the library looks at the first byte (size), skips 'size'+1 bytes to the next character size byte and repeat until the last or target character is reached.</p>
<p>The compile-time switch USE_INDEX_FONT enables indexing of the font table for faster access, at the expense of increased RAM usage. If indexing is enabled, a single lookup is required to access the character data, rather than the sequential search described above.</p>
<p>The support for fonts (methods and data) may be completely disabled if not required through the compile-time switch USE_LOCAL_FONT. This will also disable user defined fonts.</p>
<hr/>
<h2>The txt2font Utility </h2>
<p>The txt2font utility is a command line application that converts a text definition of the font into a data file in the right format for MD_MAX72xx to use.</p>
<p>This utility is as an Win32 executable. Users with other Operating Systems will need to compile a version to work with their OS, using the source code supplied.</p>
<p>The application is invoked from the command line and only the root name of the file is given as a command line parameter (eg "txt2font fred"). The application will look for and input file with a '.txt' extension (fred.txt) and produce an output file with a '.h' extension (fred.h).</p>
<p>The txt2font file format is line based. Lines starting with a '.' are directives for the application, all other lines are data for the current character defintion. An example of the beginning of a font definition file is shown below. </p><pre class="fragment">  .NAME sys_var_single
  .HEIGHT 1
  .WIDTH 0
  .CHAR 0
  .NOTE  'Empty Cell'
  .CHAR 1
  .NOTE  'Sad Smiley'
   @@@
  @@@@@
  @ @ @
  @@@@@
  @@ @@
  @   @
   @@@
  .CHAR 2
  .NOTE  'Happy Smiley'
</pre><p>The directives have the following meaning:</p><ul>
<li>.NAME defines the name for the font and is used in naming the font table variable. The name can apperar anywhere in the file. If omitted, a default name is used.</li>
<li>.HEIGHT defines the height for the font. Single height fonts are '1' and double height fonts are '2'. If double height fonts are specified then the range of ASCII character values is restricted to 0..127 as the top and botton halves of the font are stored offset by 128 positions. If omitted, the application assumes single height font.</li>
<li>.WIDTH specifies the width of the font for all the characters defined between this WIDTH and the next WIDTH defintion. 0 means variable width; any other number defines the fixed width. WIDTH may be changed within the file - for example to definine a fixed size space (no pixels!) character in a variable width font.</li>
<li>.CHAR ends the defintion of the current character and starts the defintion for the specified ASCII value. Valid parameters are [0..255] for single height, and [0..127] for double height. If a character code is omitted in the font definition file it is assumed to be empty.</li>
<li>.NOTE is an option note that will be added as a comment for the entry in the font data table.</li>
</ul>
<p>Any lines not starting with a '.' are data lines for the current character. The font characters are drawn using a non-space character (eg, '*' or '@') wherever a LED needs to be 'on'. The application scans from the top down, so any lines missing at the bottom of the character definition are assumed to be blank. However, blank lines at the top need to be shown. Any extra rows are ignored will cause program errors.</p>
<p>A number of font definition files are supplied as examples. </p><hr/>
<h2>The FontBuilder Excel/VBA application </h2>
<p>FontBuilder is an Microsoft Excel spreadsheet with VBA macros to manage a GUI interface for defining and managing font characters. FontBuilder supports both single and double height fonts. The first tab in the FontBuilder spreadsheet has instructions for use.</p>
<p>As FontBuilder requires using Microsoft Office products, it does not work environments where these are not available. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="index.html">Arduino LED Matrix Library</a></li>
    <li class="footer">Generated on Mon Feb 29 2016 18:28:24 for MD_MAX72xx LED Matrix Arduino Library by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
